package com.yun.algorithmproblem.leetcode;

import java.util.TreeSet;

public class Leetcode2829 {

	public int minimumSum(int n, int k) {
		int sum = 0;
		TreeSet<Integer> treeSet = new TreeSet<>();
		int p=0;
		while (p<n){
			if(treeSet.contains(k)){
				continue;
			}
			treeSet.add(k-p);
			sum+=p;
			p++;
		}
		return sum;
	}
}
